#include<cstdio>
long long l,r,n;
int main()
{
	freopen("candy.in","r",stdin);
	freopen("candy.out","w",stdout);
	scanf("%lld%lld%lld",&n,&l,&r);
	long long lzan=l/n,rzan=r/n;
	if(rzan-1>=lzan) 
		printf("%lld\n",n-1);
	else
		printf("%lld",(r%n)); 
	return 0;
}
